TARGETS = ipc_posix_sema ipc_sysv_sema ipc_flock mpepoller

all: $(TARGETS)

CPP = g++
CPPFLAGS = -std=c++11 -g

LIBS = -lpthread

%.o:%.cpp
	$(CPP) $(CPPFLAGS) -c $< -o $@

ipc_posix_sema: ipc_posix_sema.o
	$(CPP) $(CPPFLAGS) $^ -o ipc_posix_sema $(LIBS)
ipc_sysv_sema: ipc_sysv_sema.o
	$(CPP) $(CPPFLAGS) $^ -o ipc_sysv_sema  $(LIBS)
ipc_flock: ipc_flock.o
	$(CPP) $(CPPFLAGS) $^ -o ipc_flock  $(LIBS)
mpepoller: mp_epoller.o mp_main.o
	$(CPP) $(CPPFLAGS) $^ -o mpepoller  $(LIBS)
	
.PHONY: clean
clean:
	rm -rf $(TARGETS) *.o